package com.sdp.lease.db.l_supplier_apply.service.impl;

import com.sdp.lease.db.l_supplier_apply.entity.LSupplierApply;
import com.sdp.lease.db.l_supplier_apply.mapper.LSupplierApplyMapper;
import com.sdp.lease.db.l_supplier_apply.service.ILSupplierApplyService;
import com.sdp.lease.utils.LeaseConstants;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zsp
 * @since 2024-07-25
 */
@Service
public class LSupplierApplyServiceImpl extends ServiceImpl<LSupplierApplyMapper, LSupplierApply> implements ILSupplierApplyService {

	@Override
	public LSupplierApply queryLSupplierApplyByAccountNo(String accountNo) {
		LambdaQueryWrapper<LSupplierApply> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(LSupplierApply::getSupplierAccountNo, accountNo);
		queryWrapper.orderByDesc(LSupplierApply::getApplyTime);
		return getOne(queryWrapper,false);
	}

	@Override
	public int supplierApplyNumber() {
		LambdaQueryWrapper<LSupplierApply> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(LSupplierApply::getApplyState, LeaseConstants.申请状态_申请中.getCode());
		return count(queryWrapper);
	}

}
